import { g as xe, i as Se, b as Ee } from "./index-3bf51563.mjs";
function Le(C, z) {
  for (var O = 0; O < z.length; O++) {
    const x = z[O];
    if (typeof x != "string" && !Array.isArray(x)) {
      for (const S in x)
        if (S !== "default" && !(S in C)) {
          const m = Object.getOwnPropertyDescriptor(x, S);
          m && Object.defineProperty(C, S, m.get ? m : {
            enumerable: !0,
            get: () => x[S]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(C, Symbol.toStringTag, { value: "Module" }));
}
var V = {}, Ne = {
  get exports() {
    return V;
  },
  set exports(C) {
    V = C;
  }
};
const Ce = /* @__PURE__ */ xe(Se);
(function(C, z) {
  (function(O, x) {
    C.exports = x(Ce);
  })(self, (O) => (() => {
    var x = { 857: (f) => {
      f.exports = O;
    } }, S = {};
    function m(f) {
      var y = S[f];
      if (y !== void 0)
        return y.exports;
      var v = S[f] = { exports: {} };
      return x[f](v, v.exports, m), v.exports;
    }
    m.d = (f, y) => {
      for (var v in y)
        m.o(y, v) && !m.o(f, v) && Object.defineProperty(f, v, { enumerable: !0, get: y[v] });
    }, m.o = (f, y) => Object.prototype.hasOwnProperty.call(f, y), m.r = (f) => {
      typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(f, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(f, "__esModule", { value: !0 });
    };
    var M = {};
    return (() => {
      m.r(M), m.d(M, { default: () => he });
      var f = m(857);
      (0, f.i18nAddResources)("en", { attachment: { upload: "Upload Attachment", download: "Download Attachment" } }), (0, f.i18nAddResources)("zh-CN", { attachment: { upload: "上传附件", download: "下载附件" } });
      function y(e, t, r, o, n) {
        return { sel: e, data: t, children: r, text: o, elm: n, key: t === void 0 ? void 0 : t.key };
      }
      const v = Array.isArray;
      function _(e) {
        return typeof e == "string" || typeof e == "number" || e instanceof String || e instanceof Number;
      }
      function q(e, t, r) {
        if (e.ns = "http://www.w3.org/2000/svg", r !== "foreignObject" && t !== void 0)
          for (let o = 0; o < t.length; ++o) {
            const n = t[o];
            if (typeof n == "string")
              continue;
            const a = n.data;
            a !== void 0 && q(a, n.children, n.sel);
          }
      }
      function X(e, t, r) {
        let o, n, a, s = {};
        if (r !== void 0 ? (t !== null && (s = t), v(r) ? o = r : _(r) ? n = r.toString() : r && r.sel && (o = [r])) : t != null && (v(t) ? o = t : _(t) ? n = t.toString() : t && t.sel ? o = [t] : s = t), o !== void 0)
          for (a = 0; a < o.length; ++a)
            _(o[a]) && (o[a] = y(void 0, void 0, void 0, o[a], void 0));
        return e[0] !== "s" || e[1] !== "v" || e[2] !== "g" || e.length !== 3 && e[3] !== "." && e[3] !== "#" || q(s, o, e), y(e, s, o, n, void 0);
      }
      const ae = { type: "attachment", renderElem: function(e, t, r) {
        var o = r.isDisabled(), n = f.DomEditor.isNodeSelected(r, e), a = e, s = a.fileName, c = s === void 0 ? "" : s, u = a.link, l = u === void 0 ? "" : u;
        return X("span", { props: { contentEditable: !1 }, style: { display: "inline-block", marginLeft: "3px", marginRight: "3px", border: n && !o ? "2px solid var(--w-e-textarea-selected-border-color)" : "2px solid transparent", borderRadius: "3px", padding: "0 3px", backgroundColor: "#f1f1f1", cursor: o ? "pointer" : "inherit" }, on: { click: function() {
          o && l && window.open(l, "_blank");
        } } }, [X("img", { props: { src: "" }, style: { width: "1em", marginRight: "0.1em", minWidth: "0", minHeight: "0" } }), c]);
      } };
      function W(e) {
        return e !== null && typeof e == "object" && "constructor" in e && e.constructor === Object;
      }
      function H(e = {}, t = {}) {
        Object.keys(t).forEach((r) => {
          e[r] === void 0 ? e[r] = t[r] : W(t[r]) && W(e[r]) && Object.keys(t[r]).length > 0 && H(e[r], t[r]);
        });
      }
      const J = { body: {}, addEventListener() {
      }, removeEventListener() {
      }, activeElement: { blur() {
      }, nodeName: "" }, querySelector: () => null, querySelectorAll: () => [], getElementById: () => null, createEvent: () => ({ initEvent() {
      } }), createElement: () => ({ children: [], childNodes: [], style: {}, setAttribute() {
      }, getElementsByTagName: () => [] }), createElementNS: () => ({}), importNode: () => null, location: { hash: "", host: "", hostname: "", href: "", origin: "", pathname: "", protocol: "", search: "" } };
      function K() {
        const e = typeof document != "undefined" ? document : {};
        return H(e, J), e;
      }
      const se = { document: J, navigator: { userAgent: "" }, location: { hash: "", host: "", hostname: "", href: "", origin: "", pathname: "", protocol: "", search: "" }, history: { replaceState() {
      }, pushState() {
      }, go() {
      }, back() {
      } }, CustomEvent: function() {
        return this;
      }, addEventListener() {
      }, removeEventListener() {
      }, getComputedStyle: () => ({ getPropertyValue: () => "" }), Image() {
      }, Date() {
      }, screen: {}, setTimeout() {
      }, clearTimeout() {
      }, matchMedia: () => ({}), requestAnimationFrame: (e) => typeof setTimeout == "undefined" ? (e(), null) : setTimeout(e, 0), cancelAnimationFrame(e) {
        typeof setTimeout != "undefined" && clearTimeout(e);
      } };
      function le() {
        const e = typeof window != "undefined" ? window : {};
        return H(e, se), e;
      }
      class B extends Array {
        constructor(t) {
          typeof t == "number" ? super(t) : (super(...t || []), function(r) {
            const o = r.__proto__;
            Object.defineProperty(r, "__proto__", { get: () => o, set(n) {
              o.__proto__ = n;
            } });
          }(this));
        }
      }
      function k(e, t) {
        const r = le(), o = K();
        let n = [];
        if (!t && e instanceof B)
          return e;
        if (!e)
          return new B(n);
        if (typeof e == "string") {
          const a = e.trim();
          if (a.indexOf("<") >= 0 && a.indexOf(">") >= 0) {
            let s = "div";
            a.indexOf("<li") === 0 && (s = "ul"), a.indexOf("<tr") === 0 && (s = "tbody"), a.indexOf("<td") !== 0 && a.indexOf("<th") !== 0 || (s = "tr"), a.indexOf("<tbody") === 0 && (s = "table"), a.indexOf("<option") === 0 && (s = "select");
            const c = o.createElement(s);
            c.innerHTML = a;
            for (let u = 0; u < c.childNodes.length; u += 1)
              n.push(c.childNodes[u]);
          } else
            n = function(s, c) {
              if (typeof s != "string")
                return [s];
              const u = [], l = c.querySelectorAll(s);
              for (let i = 0; i < l.length; i += 1)
                u.push(l[i]);
              return u;
            }(e.trim(), t || o);
        } else if (e.nodeType || e === r || e === o)
          n.push(e);
        else if (Array.isArray(e)) {
          if (e instanceof B)
            return e;
          n = e;
        }
        return new B(function(a) {
          const s = [];
          for (let c = 0; c < a.length; c += 1)
            s.indexOf(a[c]) === -1 && s.push(a[c]);
          return s;
        }(n));
      }
      function Z(...e) {
        let [t, r, o, n] = e;
        function a(l) {
          const i = l.target;
          if (!i)
            return;
          const d = l.target.dom7EventData || [];
          if (d.indexOf(l) < 0 && d.unshift(l), k(i).is(r))
            o.apply(i, d);
          else {
            const E = k(i).parents();
            for (let b = 0; b < E.length; b += 1)
              k(E[b]).is(r) && o.apply(E[b], d);
          }
        }
        function s(l) {
          const i = l && l.target && l.target.dom7EventData || [];
          i.indexOf(l) < 0 && i.unshift(l), o.apply(this, i);
        }
        typeof e[1] == "function" && ([t, o, n] = e, r = void 0), n || (n = !1);
        const c = t.split(" ");
        let u;
        for (let l = 0; l < this.length; l += 1) {
          const i = this[l];
          if (r)
            for (u = 0; u < c.length; u += 1) {
              const d = c[u];
              i.dom7LiveListeners || (i.dom7LiveListeners = {}), i.dom7LiveListeners[d] || (i.dom7LiveListeners[d] = []), i.dom7LiveListeners[d].push({ listener: o, proxyListener: a }), i.addEventListener(d, a, n);
            }
          else
            for (u = 0; u < c.length; u += 1) {
              const d = c[u];
              i.dom7Listeners || (i.dom7Listeners = {}), i.dom7Listeners[d] || (i.dom7Listeners[d] = []), i.dom7Listeners[d].push({ listener: o, proxyListener: s }), i.addEventListener(d, s, n);
            }
        }
        return this;
      }
      function $() {
        for (let e = 0; e < this.length; e += 1)
          this[e].style.display = "none";
        return this;
      }
      function ee(...e) {
        let t;
        const r = K();
        for (let o = 0; o < e.length; o += 1) {
          t = e[o];
          for (let n = 0; n < this.length; n += 1)
            if (typeof t == "string") {
              const a = r.createElement("div");
              for (a.innerHTML = t; a.firstChild; )
                this[n].appendChild(a.firstChild);
            } else if (t instanceof B)
              for (let a = 0; a < t.length; a += 1)
                this[n].appendChild(t[a]);
            else
              this[n].appendChild(t);
        }
        return this;
      }
      k.fn = B.prototype;
      const ce = "resize scroll".split(" ");
      function ue(e) {
        return function(...t) {
          if (t[0] === void 0) {
            for (let r = 0; r < this.length; r += 1)
              ce.indexOf(e) < 0 && (e in this[r] ? this[r][e]() : k(this[r]).trigger(e));
            return this;
          }
          return this.on(e, ...t);
        };
      }
      const te = ue("click"), D = k;
      $ && (D.fn.hide = $), ee && (D.fn.append = ee), te && (D.fn.click = te), Z && (D.fn.on = Z);
      const ne = D;
      var F = function() {
        return F = Object.assign || function(e) {
          for (var t, r = 1, o = arguments.length; r < o; r++)
            for (var n in t = arguments[r])
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          return e;
        }, F.apply(this, arguments);
      }, re = function(e, t, r, o) {
        return new (r || (r = Promise))(function(n, a) {
          function s(l) {
            try {
              u(o.next(l));
            } catch (i) {
              a(i);
            }
          }
          function c(l) {
            try {
              u(o.throw(l));
            } catch (i) {
              a(i);
            }
          }
          function u(l) {
            var i;
            l.done ? n(l.value) : (i = l.value, i instanceof r ? i : new r(function(d) {
              d(i);
            })).then(s, c);
          }
          u((o = o.apply(e, t || [])).next());
        });
      }, oe = function(e, t) {
        var r, o, n, a, s = { label: 0, sent: function() {
          if (1 & n[0])
            throw n[1];
          return n[1];
        }, trys: [], ops: [] };
        return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
          return this;
        }), a;
        function c(u) {
          return function(l) {
            return function(i) {
              if (r)
                throw new TypeError("Generator is already executing.");
              for (; s; )
                try {
                  if (r = 1, o && (n = 2 & i[0] ? o.return : i[0] ? o.throw || ((n = o.return) && n.call(o), 0) : o.next) && !(n = n.call(o, i[1])).done)
                    return n;
                  switch (o = 0, n && (i = [2 & i[0], n.value]), i[0]) {
                    case 0:
                    case 1:
                      n = i;
                      break;
                    case 4:
                      return s.label++, { value: i[1], done: !1 };
                    case 5:
                      s.label++, o = i[1], i = [0];
                      continue;
                    case 7:
                      i = s.ops.pop(), s.trys.pop();
                      continue;
                    default:
                      if (!((n = (n = s.trys).length > 0 && n[n.length - 1]) || i[0] !== 6 && i[0] !== 2)) {
                        s = 0;
                        continue;
                      }
                      if (i[0] === 3 && (!n || i[1] > n[0] && i[1] < n[3])) {
                        s.label = i[1];
                        break;
                      }
                      if (i[0] === 6 && s.label < n[1]) {
                        s.label = n[1], n = i;
                        break;
                      }
                      if (n && s.label < n[2]) {
                        s.label = n[2], s.ops.push(i);
                        break;
                      }
                      n[2] && s.ops.pop(), s.trys.pop();
                      continue;
                  }
                  i = t.call(e, s);
                } catch (d) {
                  i = [6, d], o = 0;
                } finally {
                  r = n = 0;
                }
              if (5 & i[0])
                throw i[1];
              return { value: i[0] ? i[1] : void 0, done: !0 };
            }([u, l]);
          };
        }
      };
      function Q(e) {
        return e.getMenuConfig("uploadAttachment");
      }
      function I(e, t, r) {
        if (t && r) {
          e.restoreSelection();
          var o = { type: "attachment", fileName: t, link: r, children: [{ text: "" }] };
          e.insertNode(o), e.move(1);
          var n = Q(e).onInsertedAttachment;
          n && n(o);
        }
      }
      function fe(e, t) {
        return re(this, void 0, void 0, function() {
          var r, o, n, a;
          return oe(this, function(s) {
            switch (s.label) {
              case 0:
                return r = function(c) {
                  var u = ie.get(c);
                  if (u != null)
                    return u;
                  var l = Q(c), i = l.onSuccess, d = l.onProgress, E = l.onFailed, b = l.customInsert, j = l.onError;
                  return u = (0, f.createUploader)(F(F({}, l), { onProgress: function(h) {
                    c.showProgressBar(h), d && d(h);
                  }, onSuccess: function(h, g) {
                    if (b)
                      b(g, h, function(N, U) {
                        return I(c, N, U);
                      });
                    else {
                      var w = g.errno, L = w === void 0 ? 1 : w, T = g.data, P = T === void 0 ? {} : T;
                      if (L !== 0)
                        return console.error("'".concat(h.name, "' upload failed"), g), void E(h, g);
                      var p = P.url, A = p === void 0 ? "" : p;
                      I(c, h.name, A), i(h, g);
                    }
                  }, onError: function(h, g, w) {
                    var L = h.name;
                    console.error("'".concat(L, " upload error"), g, w), j && j(h, g, w);
                  } })), ie.set(c, u), u;
                }(e), o = t.name, n = t.type, a = t.size, r.addFile({ name: o, type: n, size: a, data: t }), [4, r.upload()];
              case 1:
                return s.sent(), [2];
            }
          });
        });
      }
      var ie = /* @__PURE__ */ new WeakMap();
      const de = function() {
        function e() {
          this.title = (0, f.t)("attachment.upload"), this.iconSvg = '<svg viewBox="0 0 1024 1024"><path d="M665.821116 327.053068l-64.958782-64.926783-324.79391 324.729911c-53.822991 53.790991-53.822991 141.053355 0 194.844347s141.053355 53.790991 194.876346 0l389.752692-389.688693a229.531696 229.531696 0 0 0 0-324.729912 229.627694 229.627694 0 0 0-324.761911 0L126.727224 476.458266l-0.863984 0.831985c-125.085655 125.085655-125.085655 327.833853 0 452.887508 125.053655 125.053655 327.865853 125.053655 452.983507 0l0.831984-0.863984 0.031999 0.032 279.322763-279.290764-64.990781-64.926782-279.322763 279.258764-0.831984 0.831984a228.731711 228.731711 0 0 1-323.065943 0 228.603714 228.603714 0 0 1 0-322.969944l0.895983-0.831985-0.031999-0.063998L600.958332 132.208721c53.694993-53.726993 141.149353-53.726993 194.876346 0s53.694993 141.149353 0 194.844347L406.081986 716.741761c-17.919664 17.919664-47.039118 17.919664-64.958782 0a45.983138 45.983138 0 0 1 0-64.926783L665.917114 327.053068z"></path></svg>', this.tag = "button";
        }
        return e.prototype.getValue = function(t) {
          return "";
        }, e.prototype.isActive = function(t) {
          return !1;
        }, e.prototype.exec = function(t, r) {
          var o = this.getMenuConfig(t), n = o.allowedFileTypes, a = n === void 0 ? [] : n, s = o.customBrowseAndUpload;
          if (s)
            s(function(i, d) {
              return I(t, i, d);
            });
          else {
            var c = "";
            a.length > 0 && (c = 'accept="'.concat(a.join(", "), '"'));
            var u = ne("body"), l = ne('<input type="file" '.concat(c, " multiple/>"));
            l.hide(), u.append(l), l.click(), l.on("change", function() {
              var i = l[0].files;
              (function(d, E) {
                var b, j;
                re(this, void 0, void 0, function() {
                  var h, g, w, L, T, P;
                  return oe(this, function(p) {
                    switch (p.label) {
                      case 0:
                        if (E == null)
                          return [2];
                        h = Array.prototype.slice.call(E), g = Q(d).customUpload, p.label = 1;
                      case 1:
                        p.trys.push([1, 9, 10, 15]), w = function(A) {
                          if (!Symbol.asyncIterator)
                            throw new TypeError("Symbol.asyncIterator is not defined.");
                          var N, U = A[Symbol.asyncIterator];
                          return U ? U.call(A) : (A = typeof __values == "function" ? __values(A) : A[Symbol.iterator](), N = {}, R("next"), R("throw"), R("return"), N[Symbol.asyncIterator] = function() {
                            return this;
                          }, N);
                          function R(G) {
                            N[G] = A[G] && function(Y) {
                              return new Promise(function(me, ge) {
                                (function(ye, ve, be, Ae) {
                                  Promise.resolve(Ae).then(function(we) {
                                    ye({ value: we, done: be });
                                  }, ve);
                                })(me, ge, (Y = A[G](Y)).done, Y.value);
                              });
                            };
                          }
                        }(h), p.label = 2;
                      case 2:
                        return [4, w.next()];
                      case 3:
                        return (L = p.sent()).done ? [3, 8] : (T = L.value, g ? [4, g(T, function(A, N) {
                          return I(d, A, N);
                        })] : [3, 5]);
                      case 4:
                        return p.sent(), [3, 7];
                      case 5:
                        return [4, fe(d, T)];
                      case 6:
                        p.sent(), p.label = 7;
                      case 7:
                        return [3, 2];
                      case 8:
                        return [3, 15];
                      case 9:
                        return P = p.sent(), b = { error: P }, [3, 15];
                      case 10:
                        return p.trys.push([10, , 13, 14]), L && !L.done && (j = w.return) ? [4, j.call(w)] : [3, 12];
                      case 11:
                        p.sent(), p.label = 12;
                      case 12:
                        return [3, 14];
                      case 13:
                        if (b)
                          throw b.error;
                        return [7];
                      case 14:
                        return [7];
                      case 15:
                        return [2];
                    }
                  });
                });
              })(t, i);
            });
          }
        }, e.prototype.isDisabled = function(t) {
          var r = t.selection;
          if (r == null || f.SlateRange.isExpanded(r))
            return !0;
          var o = f.DomEditor.getSelectedElems(t);
          return !!o.some(function(n) {
            return t.isVoid(n);
          }) || !!o.some(function(n) {
            return f.DomEditor.getNodeType(n) === "pre";
          });
        }, e.prototype.getMenuConfig = function(t) {
          return t.getMenuConfig("uploadAttachment");
        }, e;
      }(), pe = function() {
        function e() {
          this.title = (0, f.t)("attachment.download"), this.iconSvg = '<svg viewBox="0 0 1024 1024"><path d="M736 448l-256 256-256-256h160V64h192v384z m-256 256H0v256h960v-256H480z m416 128h-128v-64h128v64z"></path></svg>', this.tag = "button", this.alwaysEnable = !0;
        }
        return e.prototype.getValue = function(t) {
          var r = this.getSelectedElem(t);
          return r == null ? "" : r.link;
        }, e.prototype.isActive = function(t) {
          return !1;
        }, e.prototype.exec = function(t, r) {
          r && typeof r == "string" && window.open(r, "_blank");
        }, e.prototype.isDisabled = function(t) {
          var r = t.selection;
          return r == null || !!f.SlateRange.isExpanded(r) || this.getSelectedElem(t) == null;
        }, e.prototype.getSelectedElem = function(t) {
          var r = f.DomEditor.getSelectedNodeByType(t, "attachment");
          return r == null ? null : r;
        }, e;
      }(), he = { editorPlugin: function(e) {
        var t = e.isInline, r = e.isVoid, o = e;
        return o.isInline = function(n) {
          return f.DomEditor.getNodeType(n) === "attachment" || t(n);
        }, o.isVoid = function(n) {
          return f.DomEditor.getNodeType(n) === "attachment" || r(n);
        }, o;
      }, renderElems: [ae], elemsToHtml: [{ type: "attachment", elemToHtml: function(e, t) {
        var r = e, o = r.link, n = o === void 0 ? "" : o, a = r.fileName, s = a === void 0 ? "" : a;
        return '<span data-w-e-type="attachment" data-w-e-is-void data-w-e-is-inline data-link="'.concat(n, '" data-fileName="').concat(s, '">').concat(s, "</span>");
      } }], parseElemsHtml: [{ selector: 'span[data-w-e-type="attachment"]', parseElemHtml: function(e, t, r) {
        return { type: "attachment", link: e.getAttribute("data-link") || "", fileName: e.getAttribute("data-fileName") || "", children: [{ text: "" }] };
      } }], menus: [{ key: "uploadAttachment", factory: function() {
        return new de();
      }, config: { server: "", fieldName: "wangeditor-uploaded-attachment", maxFileSize: 10485760, maxNumberOfFiles: 5, allowedFileTypes: ["*"], meta: {}, metaWithUrl: !1, withCredentials: !1, timeout: 3e4, onBeforeUpload: function(e) {
        return e;
      }, onProgress: function(e) {
      }, onSuccess: function(e, t) {
      }, onFailed: function(e, t) {
      }, onError: function(e, t, r) {
      }, onInsertedAttachment: function(e) {
      } } }, { key: "downloadAttachment", factory: function() {
        return new pe();
      } }] };
    })(), M;
  })());
})(Ne);
const Oe = /* @__PURE__ */ Ee(V), ke = /* @__PURE__ */ Le({
  __proto__: null,
  default: Oe
}, [V]);
export {
  ke as i
};
